<?php
/**
 * 产品中心 列表文件
 *
 * @author		Arthur(ArthurXF@gmail.com)
 * @copyright	(c) 2006 by bizeway.com
 * @version		$Id$
 * @package		ArthurXF
 * @subpackage	product
 */
require_once('config/config.inc.php');
require_once("class/product.class.php");

$objWebInit = new product();
//数据库连接参数
$objWebInit->setDBG($arrGPdoDB);
$objWebInit->db();
//图像参数
$objWebInit->arrGPic = $arrGPic;
//smarty参数
if($arrGWeb['URL_static']){
	$arrGSmarty['caching'] = false;
}else{
	$arrGSmarty['cache_lifetime'] = 3600;
}
$objWebInit->arrGSmarty = $arrGSmarty;

if($_GET['id'] === null) exit;

$intID = intval($_GET['id']);
$arrInfo = $objWebInit->getInfo($intID);

if($arrInfo['id'] == '') {
	echo "<script language=JavaScript>
			alert('该页面已经删除！');
			parent.location='/';
		  </script>";
}
if($arrInfo['stars'] > 0){
	if(!empty($_SESSION['user_id'])){
		if($arrInfo['stars'] > $_SESSION['user_grade']){
			check::AlertExit("你的权限不够，无法查看",-1);
		}
	}else{
		check::AlertExit("请先登陆",-1);
	}
}

//客服QQ分拆
if(!empty($arrInfo['qq'])){
	if(strpos($arrInfo['qq'],' ') !== false){
		$arrInfo['qq'] = explode(' ',$arrInfo['qq']);
	}elseif(strpos($arrInfo['qq'],',')!==false){
		$arrInfo['qq'] = explode(',',$arrInfo['qq']);
	}else{
		$arrInfo['qq'] = explode(',',$arrInfo['qq']);
	}
}

$arrTypeInfo = $objWebInit->getTypeInfo($arrInfo['type_id']);
$strTypeTitle = $arrTypeInfo['type_title'];
$arrMOutput["smarty_assign"]['strTypeTitle'] = $strTypeTitle;

if(!empty($arrInfo['meta_Title'])) $strTitle = $arrInfo['meta_Title'];
else  $strTitle = $arrInfo['brand'].$arrInfo['title'].$arrInfo['model'];
if(!empty($arrInfo['meta_Description'])) $strDescription = $arrInfo['meta_Description'];
else  $strDescription = $strTitle.','.$arrInfo['summary'];
if(!empty($arrInfo['meta_Keywords'])) $strKeywords = $arrInfo['meta_Keywords'];
else  $strKeywords = $arrInfo['title'];

//相关产品数组
$arrInfoList = $objWebInit->getInfoList("where pass=1 and type_id = $arrInfo[type_id] and id!=$arrInfo[id]","",0,5,true,null,false);

//产品所属分类
$arrTypeList = $objWebInit->getRoueList($arrInfo['type_id']);

// 公用block
include '_block.php';
include '../comments/block/show.php';
include '../brand/block/top.php';

//全站公用block
@include '../_block.php';

// 输出到模板
$arrMOutput["smarty_assign"]['arrData'] = $arrInfo;
$arrMOutput["smarty_assign"]['arrInfoList'] = $arrInfoList;
$arrMOutput["smarty_assign"]['arrTypeList'] = $arrTypeList;
$arrMOutput["smarty_assign"]['strUserId'] = $_SESSION['user_id'];
$arrMOutput["smarty_assign"]['strUserName'] = $_SESSION['real_name'];
$arrMOutput["smarty_assign"]['FileCallPath'] = $objWebInit->arrGPic['FileCallPath'];
$arrMOutput['smarty_assign']['Title'] = $strTitle.' - '.$arrGWeb['name'];
$arrMOutput['smarty_assign']['Description'] = $strDescription.' - '.$arrGWeb['name'];
$arrMOutput['smarty_assign']['Keywords'] = $strKeywords.' - '.$arrGWeb['name'];
$arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['main_dir'].'detail.html';
$objWebInit->output($arrMOutput);
?>